import { createApp } from 'vue';
import TDesign from 'tdesign-vue-next';
import 'tdesign-vue-next/es/style/index.css';
import { store } from './store';
import router from './router';
import '@/style/index.less';
import './permission';
import '@/style/iconfont.css';
import App from './App.vue';
import { getLinkUrl } from './utils/request/upload';
import VueWechatTitle from 'vue-wechat-title';
import Carousel3d from 'vue3-carousel-3d';
import '@/utils/rem';
import 'vue3-carousel-3d/dist/index.css';
import vue3videoPlay from 'vue3-video-play'; // 引入组件
import 'vue3-video-play/dist/style.css'; // 引入css
import { Video } from '@nutui/nutui';
import '@nutui/nutui/dist/style.css';
import '@/style/swiper.css'; // 样式
// import { ActionSheet } from 'vant';
import { ImagePreview } from 'vant';
import draggable from 'vuedraggable';
import { ElTree } from 'element-plus';
import 'element-plus/dist/index.css';
import 'viewerjs/dist/viewer.css';

const isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);

const app = createApp(App);
app.config.globalProperties.$filters = {
  getLinkUrl,
};
app.use(TDesign);
app.use(store);
app.use(vue3videoPlay);
app.use(router);
app.use(Carousel3d);
app.use(VueWechatTitle);
app.use(Video);
app.use(ElTree);

app.use(ImagePreview);
// app.use(ActionSheet);
// app.mount('#app');
if (isMobile) {
  // 加载移动端样式文件
  console.log('移动端');
  import('./wapStyle/index.less').then(() => {
    app.mount('#app');
  });
} else {
  // 加载非移动端样式文件
  console.log('pc端');
  import('./webStyle/index.less').then(() => {
    app.mount('#app');
  });
}
